/*
 * @Author: cl
 * @Description: 学生
 * @Date: 2023-04-14 17:17:41
 * @LastEditTime: 2023-04-19 14:25:24
 * @FilePath: \jsnode\nestjs\naota\src\student\entities\student.entity.ts
 * @LastEditors: cl
 */
import { Column, CreateDateColumn, Entity, JoinColumn, OneToMany, OneToOne, PrimaryGeneratedColumn } from 'typeorm'
import { StuInfo } from './stuInfo.entity'
import { Score } from 'src/score/entities/score.entity'

@Entity()
export class Student {
  @PrimaryGeneratedColumn({ type: 'int' })
  id: number

  //姓名
  @Column({ type: 'varchar', length: 200 })
  name: string

  //学号
  @Column({ type: 'varchar', length: 200 })
  no: string

  @Column({ type: 'varchar', length: 200, nullable: true })
  birth: string

  @Column({
    type: 'enum',
    enum: ['男', '女'],
    default: '男',
    nullable: true,
  })
  sex: string
  //备注
  @Column({ type: 'varchar', length: 200 })
  remark: string

  @OneToOne(() => StuInfo)
  @JoinColumn()
  stuInfo: StuInfo

  url: string

  address: string

  @OneToMany(() => Score, (score) => score.student)
  score: Score[]
}
